#include "bits/stdc++.h"
using namespace std;
using ll = long long;

// 最小曼哈顿=总和-最大曼哈顿(默认)
// 曼哈顿点转换成切比雪夫(x, y) -> (x + y, x - y)
// 距离d = max((x1 + y1) / 2 - (x2 + y2) / 2, (x1 - y1) / 2 + (x2 - y2) / 2))
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);

  int n;
  cin >> n;

  auto calc = [&](vector<ll> a) {
    sort(a.begin(), a.end());
    ll sum = 0, ret = 0;
    for (int i = 0; i < n; i++) {
      ret += a[i];
      sum += 1ll * (i + 1) * a[i] - ret;
    }
    return sum * 2;
  };

  vector<ll> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }

  ll ans = calc(a) + calc(b);
  for (int i = 0; i < n; i++) {
    ll x = a[i], y = b[i];
    a[i] = x + y; b[i] = x - y;
  }
  ans -= (calc(a) + calc(b)) / 2;
  cout << ans;
  return 0;
}